const BaseUtils = require('../utils');
const code = require('../utils/code');

const utils = new BaseUtils();
module.exports = app => {
  const {
    config
  } = app;
  return (ctx, next) => {
    ctx.$http = app.$http;
    ctx.utils = utils;
    ctx.config = config;
    ctx.code = code;
    ctx.respond = code.respondBody(ctx);
    ctx.respondEncrypt = code.respondBodyEncrypt(ctx);
    return next();
  };
};

